<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>gnome-vfs-mime-utils</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
<link rel="up" href="mime-registry.html" title="MIME Registry">
<link rel="prev" href="gnome-vfs-2.0-gnome-vfs-mime.html" title="MIME typing">
<link rel="next" href="gnome-vfs-2.0-gnome-vfs-mime-database.html" title="MIME Database">
<meta name="generator" content="GTK-Doc V1.15.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnome-vfs-2.0-gnome-vfs-mime.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="mime-registry.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
<td><a accesskey="n" href="gnome-vfs-2.0-gnome-vfs-mime-database.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gnome-vfs-2.0-gnome-vfs-mime-utils.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gnome-vfs-2.0-gnome-vfs-mime-utils.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gnome-vfs-2.0-gnome-vfs-mime-utils"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gnome-vfs-2.0-gnome-vfs-mime-utils.top_of_page"></a>gnome-vfs-mime-utils</span></h2>
<p>gnome-vfs-mime-utils</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gnome-vfs-2.0-gnome-vfs-mime-utils.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">#define             <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS" title="GNOME_VFS_MIME_TYPE_UNKNOWN">GNOME_VFS_MIME_TYPE_UNKNOWN</a>
enum                <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GnomeVFSMimeEquivalence" title="enum GnomeVFSMimeEquivalence">GnomeVFSMimeEquivalence</a>;
<a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GnomeVFSMimeEquivalence" title="enum GnomeVFSMimeEquivalence"><span class="returnvalue">GnomeVFSMimeEquivalence</span></a>  <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-mime-type-get-equivalence" title="gnome_vfs_mime_type_get_equivalence ()">gnome_vfs_mime_type_get_equivalence</a>
                                                        (<em class="parameter"><code>const <span class="type">char</span> *mime_type</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *base_mime_type</code></em>);
<span class="returnvalue">gboolean</span>            <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-mime-type-is-equal" title="gnome_vfs_mime_type_is_equal ()">gnome_vfs_mime_type_is_equal</a>        (<em class="parameter"><code>const <span class="type">char</span> *a</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *b</code></em>);
const <span class="returnvalue">char</span> *        <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-get-mime-type-for-name" title="gnome_vfs_get_mime_type_for_name ()">gnome_vfs_get_mime_type_for_name</a>    (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);
const <span class="returnvalue">char</span> *        <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-get-mime-type-for-data" title="gnome_vfs_get_mime_type_for_data ()">gnome_vfs_get_mime_type_for_data</a>    (<em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> data_size</code></em>);
const <span class="returnvalue">char</span> *        <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-get-mime-type-for-name-and-data" title="gnome_vfs_get_mime_type_for_name_and_data ()">gnome_vfs_get_mime_type_for_name_and_data</a>
                                                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
                                                         <em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                                                         <em class="parameter"><code><span class="type">gssize</span> data_size</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-get-mime-type" title="gnome_vfs_get_mime_type ()">gnome_vfs_get_mime_type</a>             (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);
<span class="returnvalue">char</span> *              <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-get-slow-mime-type" title="gnome_vfs_get_slow_mime_type ()">gnome_vfs_get_slow_mime_type</a>        (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gnome-vfs-2.0-gnome-vfs-mime-utils.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1">
<a name="gnome-vfs-2.0-gnome-vfs-mime-utils.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS"></a><h3>GNOME_VFS_MIME_TYPE_UNKNOWN</h3>
<pre class="programlisting">#define GNOME_VFS_MIME_TYPE_UNKNOWN "application/octet-stream"
</pre>
<p>
The value returned for the MIME type when a file did
not match any entries in the MIME database. May be
treated as a file of an unknown type.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GnomeVFSMimeEquivalence"></a><h3>enum GnomeVFSMimeEquivalence</h3>
<pre class="programlisting">typedef enum {
  GNOME_VFS_MIME_UNRELATED,
  GNOME_VFS_MIME_IDENTICAL,
  GNOME_VFS_MIME_PARENT
} GnomeVFSMimeEquivalence;
</pre>
<p>
Describes the possible relationship between two MIME types, returned by
<a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#gnome-vfs-mime-type-get-equivalence" title="gnome_vfs_mime_type_get_equivalence ()"><code class="function">gnome_vfs_mime_type_get_equivalence()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GNOME-VFS-MIME-UNRELATED:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MIME_UNRELATED</code></span></p></td>
<td>The two MIME types are not related.
</td>
</tr>
<tr>
<td><p><a name="GNOME-VFS-MIME-IDENTICAL:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MIME_IDENTICAL</code></span></p></td>
<td>The two MIME types are identical.
</td>
</tr>
<tr>
<td><p><a name="GNOME-VFS-MIME-PARENT:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_MIME_PARENT</code></span></p></td>
<td>One of the two MIME types is a parent of the other one.
			   Note that this relationship is transient, i.e. if
			   <code class="literal">a</code> is a parent of <code class="literal">b</code> and <code class="literal">b</code> is a parent of <code class="literal">c</code>,
			   <code class="literal">a</code> is also considered a parent of <code class="literal">c</code>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-mime-type-get-equivalence"></a><h3>gnome_vfs_mime_type_get_equivalence ()</h3>
<pre class="programlisting"><a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GnomeVFSMimeEquivalence" title="enum GnomeVFSMimeEquivalence"><span class="returnvalue">GnomeVFSMimeEquivalence</span></a>  gnome_vfs_mime_type_get_equivalence
                                                        (<em class="parameter"><code>const <span class="type">char</span> *mime_type</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *base_mime_type</code></em>);</pre>
<p>
Compares <em class="parameter"><code>mime_type</code></em> to <em class="parameter"><code>base_mime_type</code></em>.  There are three possible
relationships between the two strings.
</p>
<p>
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
 If they are identical and <em class="parameter"><code>mime_type</code></em> is the same as <em class="parameter"><code>base_mime_type</code></em>,
 then <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-IDENTICAL:CAPS"><code class="literal">GNOME_VFS_MIME_IDENTICAL</code></a> is returned. This would be the case if
 "audio/midi" and "audio/x-midi" are passed in.
</p></li>
<li class="listitem"><p>
If <em class="parameter"><code>base_mime_type</code></em> is a parent type of <em class="parameter"><code>mime_type</code></em>, then
<a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-PARENT:CAPS"><code class="literal">GNOME_VFS_MIME_PARENT</code></a> is returned.  As an example, "text/plain" is a parent
of "text/rss", "image" is a parent of "image/png", and
"application/octet-stream" is a parent of almost all types.
</p></li>
<li class="listitem"><p>
Finally, if the two mime types are unrelated, then <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-UNRELATED:CAPS"><code class="literal">GNOME_VFS_MIME_UNRELATED</code></a>
is returned.
</p></li>
</ul></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mime_type</code></em> :</span></p></td>
<td>a const char * containing a mime type, e.g. "image/png".
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>base_mime_type</code></em> :</span></p></td>
<td>a const char * containing either a mime type or a base mime type.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GnomeVFSMimeEquivalence" title="enum GnomeVFSMimeEquivalence"><span class="type">GnomeVFSMimeEquivalence</span></a> indicating the relationship between <em class="parameter"><code>mime_type</code></em> and <em class="parameter"><code>base_mime_type</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-mime-type-is-equal"></a><h3>gnome_vfs_mime_type_is_equal ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>            gnome_vfs_mime_type_is_equal        (<em class="parameter"><code>const <span class="type">char</span> *a</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *b</code></em>);</pre>
<p>
Compares two mime types to determine if they are equivalent.  They are
equivalent if and only if they refer to the same mime type.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
<td>a const char * containing a mime type, e.g. "image/png".
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
<td>a const char * containing a mime type, e.g. "image/png".
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <code class="literal">TRUE</code>, if a and b are equivalent mime types.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-get-mime-type-for-name"></a><h3>gnome_vfs_get_mime_type_for_name ()</h3>
<pre class="programlisting">const <span class="returnvalue">char</span> *        gnome_vfs_get_mime_type_for_name    (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>);</pre>
<p>
Determine the mime type for <em class="parameter"><code>filename</code></em>. The file <em class="parameter"><code>filename</code></em> may
not exist, this function does not access the actual file.
If the mime-type cannot be determined, <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS" title="GNOME_VFS_MIME_TYPE_UNKNOWN"><code class="literal">GNOME_VFS_MIME_TYPE_UNKNOWN</code></a>
is returned.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td>a filename.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the mime-type for this filename or
<a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS" title="GNOME_VFS_MIME_TYPE_UNKNOWN"><code class="literal">GNOME_VFS_MIME_TYPE_UNKNOWN</code></a> if mime-type could not be determined.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-get-mime-type-for-data"></a><h3>gnome_vfs_get_mime_type_for_data ()</h3>
<pre class="programlisting">const <span class="returnvalue">char</span> *        gnome_vfs_get_mime_type_for_data    (<em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                                                         <em class="parameter"><code><span class="type">int</span> data_size</code></em>);</pre>
<p>
Tries to guess the mime type of the data in <em class="parameter"><code>data</code></em>
using the magic patterns.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>a pointer to data in memory.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_size</code></em> :</span></p></td>
<td>size of the data.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the mime-type for <em class="parameter"><code>data</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-get-mime-type-for-name-and-data"></a><h3>gnome_vfs_get_mime_type_for_name_and_data ()</h3>
<pre class="programlisting">const <span class="returnvalue">char</span> *        gnome_vfs_get_mime_type_for_name_and_data
                                                        (<em class="parameter"><code>const <span class="type">char</span> *filename</code></em>,
                                                         <em class="parameter"><code><span class="type">gconstpointer</span> data</code></em>,
                                                         <em class="parameter"><code><span class="type">gssize</span> data_size</code></em>);</pre>
<p>
Determine the mime-type for <em class="parameter"><code>filename</code></em> and <em class="parameter"><code>data</code></em>. This function tries
to be smart (e.g. mime subclassing) about returning the right mime-type 
by looking at both the <em class="parameter"><code>data</code></em> and the <em class="parameter"><code>filename</code></em>. The file will not be 
accessed.
If the mime-type cannot be determined, <a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS" title="GNOME_VFS_MIME_TYPE_UNKNOWN"><code class="literal">GNOME_VFS_MIME_TYPE_UNKNOWN</code></a>
is returned.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em> :</span></p></td>
<td>a filename.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em> :</span></p></td>
<td>a pointer to the data in the memory
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_size</code></em> :</span></p></td>
<td>the size of <em class="parameter"><code>data</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the mime-type for this filename or
<a class="link" href="gnome-vfs-2.0-gnome-vfs-mime-utils.html#GNOME-VFS-MIME-TYPE-UNKNOWN:CAPS" title="GNOME_VFS_MIME_TYPE_UNKNOWN"><code class="literal">GNOME_VFS_MIME_TYPE_UNKNOWN</code></a> if mime-type could not be determined.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-get-mime-type"></a><h3>gnome_vfs_get_mime_type ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              gnome_vfs_get_mime_type             (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);</pre>
<p>
Determine the mime type of <em class="parameter"><code>text_uri</code></em>. The mime type is determined
in the same way as by <a class="link" href="gnome-vfs-2.0-gnome-vfs-file-info-ops.html#gnome-vfs-get-file-info" title="gnome_vfs_get_file_info ()"><code class="function">gnome_vfs_get_file_info()</code></a>. This is meant as
a convenient function for times when you only want the mime type.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text_uri</code></em> :</span></p></td>
<td>path of the file for which to get the mime type.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The mime type, or <a href="/gnome/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL--CAPS"><code class="literal">NULL</code></a> if there is an error reading
the file.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gnome-vfs-get-slow-mime-type"></a><h3>gnome_vfs_get_slow_mime_type ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *              gnome_vfs_get_slow_mime_type        (<em class="parameter"><code>const <span class="type">char</span> *text_uri</code></em>);</pre>
<p>
Determine the mime type of <em class="parameter"><code>text_uri</code></em>. The mime type is determined
in the same way as by <a class="link" href="gnome-vfs-2.0-gnome-vfs-file-info-ops.html#gnome-vfs-get-file-info" title="gnome_vfs_get_file_info ()"><code class="function">gnome_vfs_get_file_info()</code></a>. This is meant as
a convenience function for times when you only want the mime type.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>text_uri</code></em> :</span></p></td>
<td>URI of the file for which to get the mime type
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The mime type, or NULL if there is an error reading 
the file.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.15.1</div>
</body>
</html>